﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Data;
using System.Web.UI.WebControls;
using weikebuluo.Model;
using weikebuluo.DAL;
using weikebuluo.Common;

namespace weikeweixin.web.admin.wechat
{
    public partial class articlelist : weikeweixin.web.admin.cs.adminbase
    {
        w_article_dal articledal = new w_article_dal();
        JsonOperate JsonOperate = new JsonOperate();
        protected void Page_Load(object sender, EventArgs e)
        {
            switch (Request.QueryString["action"]) { 
                case "articlelist":
                    list();
                    break;
                case "del":
                    del();
                    break;

            }
        }
        //liebiao
        private void list() {
            string where = "";
            if (!string.IsNullOrEmpty(Request.Form["article_id"]))
            {
                where = "article_layid=" + Request.Form["article_id"] + " and useer_id=" + user_id;
            }
            else {
                where = "article_layid=0 and useer_id=" + user_id;
            }
            DataTable dtarticle = articledal.GetList(where).Tables[0];
            Response.Write(JsonOperate.TableToBasicJson(dtarticle));
            Response.End();
        }
        private void del() {
            articledal.Delete(int.Parse(Request.QueryString["id"].Trim()));
        }
    }
}